classdef amcrackchan < handle
    %AMRACK Summary of this class goes here
    %   Detailed explanation goes here
    
    properties
        max=inf;
        min=-inf;
        maxrate=inf;
        channel;
        multiplier=1;
        const=0;
        name;
    end
    
    methods
        function amrc=amcrackchan(name,channel)
            amrc.name=name;
            amrc.channel=channel;
        end
        function instr=inst(amrc) %note this produces a vector output
            global amrack;
            indcells=cellfun(@(y) cellfun(@(x) ismember(y,x),{amrack.insts.channels}),{amrc.channel},'UniformOutput',0);
            cellinstr=cellfun(@(x) amrack.insts(x),indcells,'UniformOutput',0);
            instr=[cellinstr{:}];
        end
        function delete(amrc)
            global amrack;
            amrack.rackchans(amrack.rackchans==amrc)=[]; %add 'if exists' to this?
            %amrack.loops.allchans(amrack.rackchans==amrc)=[]; %this probably needs to be done in two steps, test w/ two loops
            %amrack.plots.allchans(amrack.rackchans==amrc)=[];
            %
        end
    end
    
end

